//
//  MapVC.m
//  T98
//
//  Created by huazi on 14/11/7.
//  Copyright (c) 2014年 T98. All rights reserved.
//

#import "MapVC.h"

@interface MapVC ()

@end

@implementation MapVC

- (void)viewDidLoad {
    self.titleForNav =@"位置信息";
    [super viewDidLoad];
    _mapView =[[BMKMapView alloc] initWithFrame:CGRectMake(0, 0, DeviceWidth, DeviceHeight)];
    [self.view addSubview:_mapView];
    [self addMapPoint];
    // Do any additional setup after loading the view.
}
- (void)viewWillAppear:(BOOL)animated
{
    [_mapView viewWillAppear];
    _mapView.delegate =self;
    [super viewWillAppear:YES];
}
- (void)viewWillDisappear:(BOOL)animated
{
    [_mapView viewWillDisappear];
    _mapView.delegate =self;
    [super viewWillDisappear:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)addMapPoint
{
    BMKPointAnnotation *pointAnnotation =[[BMKPointAnnotation alloc] init];
    CLLocationCoordinate2D coor;
    coor.latitude =[[self.dicMessage objectForKey:@"valueY"] floatValue];
    coor.longitude =[[self.dicMessage objectForKey:@"valueX"] floatValue];
    pointAnnotation.coordinate =coor;
    pointAnnotation.title =[self.dicMessage objectForKey:@"Name"];
    [_mapView addAnnotation:pointAnnotation];
    [_mapView selectAnnotation:pointAnnotation animated:YES];
    BMKCoordinateSpan span ={0.1,0.1};
    CLLocationCoordinate2D locationAddress =coor;
    BMKCoordinateRegion region ={locationAddress, span};
    [_mapView setRegion:region];
    
}


@end
